home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
source
/
parallax
/
overview.doc
< prev
next >
Wrap
Text File
|
1994-09-01
|
3KB
|
115 lines
Here is a skeleton of the main loop:
1) px and py are the players coordinates.
These are kept in world coords.
The world coords range in value from
0..32*<x or y size of map>
I use 32 because my tiles are 32X32...
2)
screen_x := px SHR 5; { Transform world coords to map coords }
screen_x := screen_x - 4;
screen_y := py SHR 5;
screen_y := screen_y - 2;
soff_x := px AND 31; { Need offset in current map x, y }
soff_y := py AND 31; { Same as px MOD 32 }
off_x := soff_x; { Save offsets, needed for background to }
off_y := soff_y; { work right in some instances...}
IF (screen_x < 1) THEN { Next stuff is so that player }
BEGIN { Moves close to edge of screen }
screen_x := 1; { if near map edge...}
soff_x := 0;
END
ELSE
IF (screen_x > 117) THEN
BEGIN
screen_x := 117;
soff_x := 31;
END;
IF (screen_y < 1) THEN
BEGIN
screen_y := 1;
soff_y := 0;
END
ELSE
IF (screen_y > 119) THEN
BEGIN
screen_y := 119;
soff_y := 31;
END;
Draw_Screen_ASM (screen_x, screen_y, soff_x, soff_y, shape_ptr^,
bshape_ptr^, map^, bmap^, Close_Terrain,
FAnim^, BAnim^, bscroll);
**** shape_ptr, bshape_ptr are pointers to the tile images for
background and foreground.
**** map, bmap are pointer to the map arrays for fore and back.
**** FAnim and BAnim are pointers to the animation records for
the foreground and background...
**** Close terrain is a structure set up to hold data on images
found to be covering the player...
Draw_People; { Draws the player as of now }
{ Draw stuff the player passes behind }
Draw_Close_Terrain (Shape_Ptr^, Close_Terrain);
{ Blit virtual screen to video mem }
Copy_Part_Screen_Diff (0, 0, 0+soff_x, 0+soff_y, 270, 160)
3) Thats basically the main loop...
See provided routines.doc file for the procedures that are called...
**** Overview of structures:
Close_Terrain_Type = ARRAY[0..199] of byte;
Shape_Type = ARRAY[0..65534] of char;
Shape_Type_Ptr = ^Shape_Type;
Shape_Mask_Type = ARRAY[0..4095] of byte;
Shape_Mask_Ptr = ^Shape_Mask_Type;
Shape_Anim_Type = ARRAY[0..1023] of byte;
Shape_Anim_Ptr = ^Shape_Anim_Type;
Map_Type = ARRAY[0..16383] of byte;
Map_Ptr = ^Map_Type;
** player_ptr is a pointer to the players image data, like all
the rest...
** bscroll is a variable that determines if the background
will scroll or not..
If zero, will not scroll..
If > zero, will scroll...
This was not fully implemented when I quit working on
this engine...